<template>
    <div class="fkzm">
        <img src="//common-1253410441.file.myqcloud.com/activityimg/20171211133006.jpg" alt="">
        <img @click="getmyred" src="//common-1253410441.file.myqcloud.com/activityimg/20171211133007.png" alt="">
        <img src="//common-1253410441.file.myqcloud.com/activityimg/20171211133008.png" alt="">
        <div class="fixeddiv" v-if="show">
            <section>
                <i @click="closefn"></i>
                <img src="//common-1253410441.file.myqcloud.com/activityimg/20171211143854.png" alt="">
                <a @click="jump" href="javascript:;"></a>
            </section>
        </div>
    </div>

</template>

<script>
    import {Marquee, MarqueeItem, Toast} from 'vux';
    import {getMytoken, getLogintoken} from '../../services/common';
    import {h5tonative} from '../../utils/otherfn';
    import {namesource, jumptype} from '../../utils/config/common';
    import axios from 'axios';
    export default {
        components: {
            Marquee,
            MarqueeItem,
            Toast
        },
        data() {
            return {
                show: false
            };
        },
        created() {
        },
        computed: {},
        methods: {
            jump(){
                h5tonative('我的红包', `${location.origin}/#/my/redenvelop`)
            },
            closefn(){
                this.show = false;
            },
            async getmyred(){
                const {token}=await getMytoken(true);
                if(!token) {
                    getLogintoken(function (value) {
                        console.log('vvv', value);
                        if(value) {
                            location.reload();
                        }
                    }).then(({token})=> {
                    });
                    return;
                }
                const {data}=await axios.get(`/hd/Handler.ashx?action=1151&params={"UserCode":"${token}"}`);
                if(data && data.code === 0) {
                    this.show = true;
                }
                else {
                    this.$vux.toast.text(data.msg);
                }
            }
        }
    }
</script>
<style scoped lang="less" rel="stylesheet/less">
    .fkzm {
        img {
            display: block;
            width: 100%;
        }
    }

    .fixeddiv {
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, .7);
        section {
            position: relative;
            top: 20%;
            i {
                position: absolute;
                width: 80px;
                height: 80px;
                right: 80px;
                top: 0;
            }
            a {
                width: 100%;
                position: absolute;
                bottom: 0;
                left: 0;
                height: 160px;
            }

        }
    }

</style>